package com.google.gwt.it2tool.client;

import java.io.Serializable;
import java.util.TreeMap;

public class CustomFactoryOrder implements Serializable{
	
	//Order number/ID
	private TreeMap<String,Integer> order = new TreeMap<String, Integer>();
	
	public CustomFactoryOrder(){
		super();
	}
	
	public CustomFactoryOrder(TreeMap<String,Integer> order){
		super();
		this.order=order;
	}
	
	public TreeMap<String, Integer> getOrder() {
		return order;
	}

	public void setOrder(TreeMap<String, Integer> order) {
		this.order = order;
	}

	public void setFactoryPosition(Factory fac, int pos){		
			order.put(fac.getId(),pos);		
	}
	
	public int getPositionForFactory(Factory fac){
		if (order.containsKey(fac.getId())){
			return order.get(fac.getId());
		}else{
			return 0;
		}
	}
	
	public TreeMap<String,Integer> getFactoryOrder(){
		return order;
	}

}
